<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="static/jquery-easyui-1.5.5.3/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="static/jquery-easyui-1.5.5.3/themes/bootstrap/easyui.css"/>
<link rel="stylesheet" type="text/css" href="static/jquery-easyui-1.5.5.3/themes/icon.css"/>
<script type="text/javascript" src="static/jquery-easyui-1.5.5.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/jquery-easyui-1.5.5.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
$(function(){
	$("#pad").textbox({
		width: 200,
		missingMessage:'原密码必填'
	});
	$("#pad1").textbox({
		width: 200,
		missingMessage:'新密码必填'
	});
	$("#pad2").textbox({
		width: 200,
		missingMessage:'确认密码必填'
	});
	
	function fun1(str){
		$.post('pwd', {password: str}, function(data){
			if(! data){
				$("#pad-error").html("原密码输入错误");
			}else {
				$("#pad-error").html("");
			}
		});
	}
	
	$("#btn_1").click(function(){
		var pad1 = $("#pad1").val();
		var pad2 = $("#pad2").val();
		var str = $("#pad").val();
		var f = false;
		if(str == "" || str == null){
			f = true;
			$("#pad-error").html("请输入原密码");
		}else if(pad1 == "" || pad1 == null){
			f = true;
			$("#pad1-error").html("请输入密码");
		}else if(pad2 == "" || pad2 == null){
			f = true;
			$("#pad1-error").html("");
			$("#pad2-error").html("请确认密码");
		}else if(pad1 != pad2){
			f = true;
			$("#pad1-error").html("");
			$("#pad2-error").html("两次密码不一致");
		}
		if(!f){
			$.post('pwd', {password: str}, function(data){
				if(data){
					alert("修改成功！");
					window.location.href="xg?pad="+pad1;
				}
			});
		}
	});
});
</script>
<style type="text/css">
	*{
		margin: 0px;
		padding: 0px;
	}
	#home{
		margin: 0px auto;
		margin-top: 91px;
		padding: 20px 30px;
		width: 80%;
		background: white;
	}
	#zx:hover{
		cursor: pointer;
	}
</style>
</head>
<body>
<div>
	<div id="home">
		<div style="height: 370px;"><br><br>
			<form action="" method="post" >
				<center>
					<div>
						<span>请输入原密码：</span>
						<input type="password" id="pad" onchange="fun1(this.value);" class="easyui-validatebox">
					</div>
					<div><label id="pad-error" for="pad"></label></div><br>
					<div class="input-group">
						<span>请输入新密码：</span>
						<input type="password" id="pad1" class="easyui-validatebox">
					</div>
					<div><label id="pad1-error" for="pad1"></label></div><br>
					<div>
						<span>请确认密码：</span>
						<input type="password" id="pad2" class="easyui-validatebox">
					</div>
					<div><label id="pad2-error" for="pad2"></label></div><br>
					<button type="button" id = "btn_1" style="width:200px;" class="easyui-linkbutton">确定</button>
				</center>
			</form>
		</div>
	</div>
</div>
</body>
</html>